package com.agv.core.lectorDeGlobalizadoresImpl;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Remarks {

	public ArrayList<String> clienteRemarks(String linea) {
		ArrayList<String> tokens = new ArrayList<String>();
		try {
			Scanner scanner = new Scanner(linea);
			String token;
			do {
				token = scanner.findInLine("/C\\d{1,2}-\\d{1,2}\\*([[^/].])+/");
				if(token!=null)
					tokens.add(token);
			} while (token != null);
		} catch (Exception e) {
			System.out.println("scan exc");
		}
		return tokens;
	}

	public ArrayList<String> gRemarks(String linea) {
		ArrayList<String> tokens = new ArrayList<String>();
		try {
			Scanner scanner = new Scanner(linea);
			String token;
			do {
				token = scanner.findInLine("/C\\d{1,2}\\*([[^/].])+/");
				if(token!=null)
					tokens.add(token);
			} while (token != null);
		} catch (Exception e) {
			System.out.println("scan exc");
		}
		return tokens;
	}

//	public static void main(String[] args) {
//		Remarks r = new Remarks();
//		String f = "C:/Documents and Settings/casa/Mis documentos/agv/ArchivosGDS/" +
//		"08505131.dat";
//		BufferedReader entrada;
//		try {
//			entrada = new BufferedReader(new FileReader(f));
//			String line;
//			while (entrada.ready()) {
//				line = entrada.readLine();
//				ArrayList<String> c = new ArrayList<String>();
//				ArrayList<String> g = new ArrayList<String>();
//				c = r.clienteRemarks(line);
//				g = r.gRemarks(line);
//				System.out.println("cliente");
//				for (int i = 0; i < c.size(); i++) {
//					System.out.println("token: "+c.get(i));
//				}
//				System.out.println("general");
//				for (int i = 0; i < g.size(); i++) {
//					System.out.println("token: "+g.get(i));
//				}
//			}
//		} catch (IOException e) {
//			e.printStackTrace();
//		}
//	}
}
